fix(cloudflare): use raw binding format for llama-3.2-11b-vision-instruct#54
Merged
stackbilt-admin merged 2 commits intomainfrom Apr 27, 2026
Merged
Conversation
…ruct (#53) Workers AI binding for this model requires { image: number[], prompt, max_tokens } instead of the OpenAI-compatible messages/image_url format. The chat path returns choices[0].message.content === null via the binding, causing extractText() to silently return "". Other vision models are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Guard against multiple images (silent truncation → explicit error) - Flatten array-content user messages into raw binding prompt string - Default max_tokens to 512 when not provided (avoids undefined) - Expand LLAMA_VISION_RAW_MODELS comment for future maintainers - Three new tests covering the above Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
analyzeImage()with@cf/meta/llama-3.2-11b-vision-instructwas silently returning{ content: "", message: "" }when called via the Workers AI binding{ image: number[], prompt, max_tokens }— the chat/image_urlformat returnschoices[0].message.content === null, whichextractText()maps to""runLlamaVisionRaw(), which converts base64 →number[], extracts the prompt from system + last user message, and callsai.run()with the raw formatgemma-4-26b-a4b-it,llama-4-scout-17b-16e-instruct) are unaffected — they continue using the chat formatTest plan
ai.run()is called with{ image: number[], prompt, max_tokens }(nomessageskey) for llama-3.2result.contentis populated from{ response: "..." }— not emptypromptdata:URL input pathgemma-4still uses chat/image_urlformatCloses #53. Patch release →
1.5.1.🤖 Generated with Claude Code